#include <stdio.h>
#include <unistd.h>

int main()
{
  chdir("/home/xyc/");
  FILE* fp = fopen("./log.txt", "a");//以a方式打开
  if(fp == NULL)
  {
    perror("fopen fail");
    return -1;
  }
  fputs("hello file!\n", fp);
  fclose(fp);
  return 0;
}
